/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.cellstore.entidad;

import java.io.Serializable;
import javax.persistence.*;

/**
 *
 * @author paescobar
 */
@Entity
@Table(name = "tb_parametro")
@NamedQueries({
    @NamedQuery(name = "TbParametro.findAll", query = "SELECT t FROM TbParametro t"),
    @NamedQuery(name = "TbParametro.findByIdParametro", query = "SELECT t FROM TbParametro t WHERE t.tbParametroPK.idParametro = :idParametro"),
    @NamedQuery(name = "TbParametro.findByIdDominio", query = "SELECT t FROM TbParametro t WHERE t.tbParametroPK.idDominio = :idDominio"),
    @NamedQuery(name = "TbParametro.findByDescripcion", query = "SELECT t FROM TbParametro t WHERE t.descripcion = :descripcion"),
    @NamedQuery(name = "TbParametro.findByAbreviatura", query = "SELECT t FROM TbParametro t WHERE t.abreviatura = :abreviatura"),
    @NamedQuery(name = "TbParametro.findByValor", query = "SELECT t FROM TbParametro t WHERE t.valor = :valor")})
public class TbParametro implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TbParametroPK tbParametroPK;
    @Basic(optional = false)
    @Column(name = "descripcion")
    private String descripcion;
    @Column(name = "abreviatura")
    private String abreviatura;
    @Basic(optional = false)
    @Column(name = "valor")
    private String valor;
    @JoinColumn(name = "id_dominio", referencedColumnName = "id_dominio", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private TbDominio tbDominio;

    public TbParametro() {
    }

    public TbParametro(TbParametroPK tbParametroPK) {
        this.tbParametroPK = tbParametroPK;
    }

    public TbParametro(TbParametroPK tbParametroPK, String descripcion, String valor) {
        this.tbParametroPK = tbParametroPK;
        this.descripcion = descripcion;
        this.valor = valor;
    }

    public TbParametro(int idParametro, int idDominio) {
        this.tbParametroPK = new TbParametroPK(idParametro, idDominio);
    }

    public TbParametroPK getTbParametroPK() {
        return tbParametroPK;
    }

    public void setTbParametroPK(TbParametroPK tbParametroPK) {
        this.tbParametroPK = tbParametroPK;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public String getAbreviatura() {
        return abreviatura;
    }

    public void setAbreviatura(String abreviatura) {
        this.abreviatura = abreviatura;
    }

    public String getValor() {
        return valor;
    }

    public void setValor(String valor) {
        this.valor = valor;
    }

    public TbDominio getTbDominio() {
        return tbDominio;
    }

    public void setTbDominio(TbDominio tbDominio) {
        this.tbDominio = tbDominio;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tbParametroPK != null ? tbParametroPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TbParametro)) {
            return false;
        }
        TbParametro other = (TbParametro) object;
        if ((this.tbParametroPK == null && other.tbParametroPK != null) || (this.tbParametroPK != null && !this.tbParametroPK.equals(other.tbParametroPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.mycompany.mavenproject2.TbParametro[ tbParametroPK=" + tbParametroPK + " ]";
    }
    
}
